<?php
/*---------------------------------------------------------------------------
  网络民兵指挥管理系统 - 让工作更轻松快乐
 -------------------------------------------------------------------------*/

namespace Home\Controller;

class EducationGradeController extends HomeController {
	protected $config=array('app_type'=>'master');

	function _search_filter(&$map) {
		$keyword=I('keyword');
		if (!empty($keyword)) {
			$map['name'] = array('like', "%" .$keyword . "%");
		}
	}
	
	function del(){
		$id=$_POST['id'];
		$this->_destory($id);		
	}

    public function datadic(){
        $this->_index();
    }

    public function read_datadic($id){
        $this->_edit($id);
    }
    public function manage() {
        $user_id = get_user_id();
        $this -> assign('user_id', $user_id);
        $plugin['date'] = true;
        $plugin['editor'] = true;
        $this -> assign("plugin", $plugin);

        $model = D("PartyMember");
        $map = $this -> _search();
        if (method_exists($this, '_search_filter')) {
            $this -> _search_filter($map);
        }
        if (!empty($model)) {
            $this -> _list($model, $map, 'id desc');
        }
        //可以在此构造下拉框数据

        $this -> display();
    }
    public function add() {
        $user_id = get_user_id();
        $this -> assign('user_id', $user_id);
        $plugin['jquery-ui'] = true;
        $plugin['date'] = true;
        $plugin['editor'] = true;
        $this -> assign("plugin", $plugin);
        //可以在此构造下拉框数据
        $this -> display();
    }
    public function edit($id) {
        $user_id = get_user_id();
        $this -> assign('user_id', $user_id);
        $plugin['jquery-ui'] = true;
        $plugin['date'] = true;
        $plugin['editor'] = true;
        $this -> assign("plugin", $plugin);
        //可以在此构造下拉框数据
        $this -> _edit($id);
    }
    public function index() {
        $user_id = get_user_id();
        $this -> assign('user_id', $user_id);
        $plugin['date'] = true;
        $this -> assign("plugin", $plugin);

        $model = D("EducationGrade");
        $map = $this -> _search();
        if (method_exists($this, '_search_filter')) {
        $this -> _search_filter($map);
        }
        if (!empty($model)) {
            $this -> _list($model, $map, 'id desc');
        }
        //可以在此构造下拉框数据
        $this -> display();
    }

    public function userindex() {
        $user_id = get_user_id();
        $this -> assign('user_id', $user_id);
        $plugin['date'] = true;
        $this -> assign("plugin", $plugin);

        $model = D("EducationGrade");
        $map = $this -> _search();
        if (method_exists($this, '_search_filter')) {
            $this -> _search_filter($map);
        }
        $map['user_id'] = array('eq', $user_id);
        if (!empty($model)) {
            $this -> _list($model, $map, 'id desc');
        }
//可以在此构造下拉框数据
        $this -> display();
    }
    public function posterindex() {
        $user_id = get_user_id();
        $this -> assign('user_id', $user_id);
        $plugin['date'] = true;
        $this -> assign("plugin", $plugin);

        $model = D("EducationGradeView");
        $map = $this -> _search();
        if (method_exists($this, '_search_filter')) {
            $this -> _search_filter($map);
        }
        $map['is_post'] = array('eq', 1);
        if (!empty($model)) {
            $this -> _list($model, $map, 'id desc');
        }
//可以在此构造下拉框数据
        $this -> display();
    }

    public function readonly($id) {
        $this->read($id);
    }

    public function read($id) {
        $user_id = get_user_id();
        $this -> assign('user_id', $user_id);
        $plugin['jquery-ui'] = true;
        $plugin['date'] = true;
        $this -> assign("plugin", $plugin);
        $model = D("EducationGradeView");
        $vo = $model -> find($id);
        $this -> assign('vo', $vo);
        if (IS_AJAX) {
            if ($vo !== false){
                $return['data'] = $vo;
                $return['status'] = 1;
                $return['info'] = "读取成功";
                $this -> ajaxReturn($return);
            } else {
                $return['status'] = 0;
                $return['info'] = "读取错误";
                $this -> ajaxReturn($return);
            }
        }
        //可以在此构造下拉框数据

        $this -> display();
    }
    public function upload() {
        $this -> _upload();
    }
}?>